#pragma once

#include "ImgCapPlugHeader.h"

#include "DDirectDisplay.h"
#include "DD_ImagePro.h"
#include "ImageMan.h"

class xDefaultCap :public ImgCapPlug, public ImageMan
{
public:
	xDefaultCap(void);
	~xDefaultCap(void);

public: 
	//get this plug description
	virtual int GetPlugDescription( zkCapDevDesc *pDescs,int &nCount );
	virtual int SelectCap( zkCapDevDesc *pDesc );

public:
	//must init
	virtual int Initialize();
	//
	virtual int SetHwnd(HWND hWnd);
	//
	virtual int RegOnDrawCallBack(OnDrawCallBackFun funCallBack,void *pContext);

	virtual int OpCaptureParam(void *pVoid = NULL);
		
	//
	virtual int GetImageSize(int &nWidth,int &nHeight);
	virtual int GetImageInfo(zkImgBitInfo **ppImgBitInfo);

	//
	virtual int StartCapture();
	//stop active
	virtual int StopCapture();
	//
	virtual int	Draw(void *pVoid = NULL);

	//mustn't delete ppBitInfo and ppData
	virtual int GetImageData( zkImgBitInfo **ppImgBitInfo );

	//get live Histogram Info
	virtual int GetLiveHistogramInfo(void **ppHistogram);
	virtual int GetGrayValue(int x,int y,DWORD &dwGray);

public:
	virtual int SelectBadPixelFile(char *pFileName);
	//select revise file
	virtual int SelectReviseFile(char *pFileName,int nCreateRevise = 0);

public:
	//create revise
	virtual int CreateRevise(void *pVoid=NULL);
	virtual int SetReviseGrade(int nGrade);
	virtual int SaveReviseFile(char *pFileName);

public:
	//create revise
	virtual int CreateBadPixelRevise(void *pVoid=NULL);
	virtual int SetBadPixelReviseGrade(int nGrade);
	virtual int SaveBadPixelReviseFile(char *pFileName);
	virtual int GetBadPixelValue(int x,int y,DWORD &dwValue);
	virtual int SetBadPixelValue(int x,int y,DWORD dwValue);

public:
	virtual int SetRecordParam(void *pVoid = NULL);
	virtual int StartRecord(char *pFileName);
	virtual int StopRecord();

private:
	void SetDataToDx();
	int StartCapture2(); 
	void ImageInteTimes();



    
private:
	DD_ImagePro	m_xImagePro;


};
